Public Class TabStripChildControls
    Inherits System.Web.UI.Page

    Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
        MyBase.OnInit(e)
        DotNetNuke.UI.Utilities.ClientAPI.HandleClientAPICallbackEvent(Me)
    End Sub

	Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Me.lblTime.Text = Now.ToString
	End Sub

    Private Sub MyDNNLabelEdit_UpdateLabel(ByVal source As Object, ByVal e As DotNetNuke.UI.WebControls.DNNLabelEditEventArgs)
        'update database here
    End Sub

    Private Sub tabDropDownLists_SetupDefaults() Handles tabDropDownLists.SetupDefaults
        If tabDropDownLists.IsPostBack = False Then
            'If this is the first time the tab is loaded, we need to set it up
            PopulateDropDownLists()
        End If
    End Sub

    'We are populating the dropdowns to simulate viewstate.  This event is only fired if 
    'a tab has been rendered to the client.  Shortly after this event the LoadPostData 
    'event of the dropdowns will be called as part of the ASP.NET lifecycle.
    'If the DropDown has items at this point, things like SelectedValue and SelectedItem
    'will function.  
    Private Sub tabDropDownLists_PreLoadPostData() Handles tabDropDownLists.PreLoadPostData
        PopulateDropDownLists()
    End Sub

    Private Sub PopulateDropDownLists()
        Me.ddlDynamic1.Items.Add(New ListItem("Dynamic1Text", "Dynamic1Value"))
        Me.ddlDynamic1.Items.Add(New ListItem("Dynamic2Text", "Dynamic2Value"))
    End Sub

    Private Sub btnDDLSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDDLSave.Click
        'The Static dropdownlist does not require the use of viewstate, the values are 
        'persisted with the aspx markup.  However, the dynamic dropdown also works now 
        'that we populated the items in the PreLoadPostData event.
        txtDropDowns.Text = "ddlStatic SelectedValue=" & ddlStatic.SelectedValue & vbCrLf & "ddlDynamic SelectedValue=" & ddlDynamic1.SelectedValue
    End Sub

End Class
